package cn.smile.controller;

import cn.smile.config.shiro.CasPathConfig;
import cn.smile.config.shiro.config.ShiroConfiguration;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: MaoSuyu
 * @User：John
 * @Date: 2019/7/15
 * @Time: 18:38
 * @Description: No Description
 */
@Controller
public class TestController {

    @GetMapping("/start")
    public String start(){
        return "redirect:"+ CasPathConfig.LOGIN_URL;
    }

    @GetMapping("/sayHi")
    @RequiresPermissions("hello")
    @ResponseBody
    public String shiro(){
        return "sayHi";
    }

    @GetMapping("/index")
    @ResponseBody
    public String index(){
        return "Hello";
    }

    @GetMapping("/liusiqing")
    @ResponseBody
    public String liusiqing(){
        return "liusiqing";
    }

    @GetMapping("/failure")
    @ResponseBody
    public String failure(){
        return "failure";
    }

    @GetMapping("/unauthorized")
    @ResponseBody
    public String unauthorized(){
        return "UNAUTHORIZED";
    }

    @GetMapping("/lout")
    @ResponseBody
    public String logout(){
        return "LOGOUT";
    }
}
